import requests from '@src/common/request'

export function load() {
	return requests.post({
		url: '/booking_admin/booking_manage/query_order_list',
		data: {
			pageNum: 1,
			pageSize: 10
		}
	})
}

//预下单接口
export function preOrderFun(orderPreForm) {
	return requests.post({
		url: '/mall/mobile/order/pre_order',
		data: orderPreForm
	})
}

//获取预下单信息
export function getPreOrderMsgFun(preNo) {
	return requests.get('/mall/mobile/order/get_pre_order?preNo=' + preNo)
}

//获取余额信息
export function getInfo() {
	return requests.get('/memberApp/memberAccount/info')
}

//创建订单
export function createOrder(createForm) {
	return requests.post({
		url: '/mall/mobile/order/create',
		data: createForm,
		ignoreError: true
	})
}

//创建订单
export function queryOrderStatus(params) {
	return requests.get({
		url: '/mall/mobile/order/get_order_status',
		params: params,
		ignoreError: true
	})
}


//发起余额支付
export function balancePay(payRequest) {
	return requests.post({
		url: '/mall/mobile/order_pay/balance_pay',
		data: payRequest,
		ignoreError: true
	})
}

//发起微信支付
export function wxPrepay(payRequest) {
	return requests.post({
		url: '/mall/mobile/order_pay/wx_prepay',
		data: payRequest,
		ignoreError: true
	})
}

//获取订单详情
export function orderDetail(orderNo) {
	return requests.get('/mall/mobile/order/get_order_detail?orderNo=' + orderNo)
}

//取消订单
export function cancelOrderFunc(orderCancelForm) {
	return requests.post({
		url: '/mall/mobile/order/cancel',
		data: orderCancelForm
	})
}

//拉取优惠券信息接口
//订单类型, 1:收银台收款, 2: 会员卡充值, 3: 预存开卡, 4: 付费开卡, 5: 微商城, 6: 微餐饮, 7: 预
export function getCouponDiscount(discountQuery) {
	return requests.post({
		url: '/order_mobile/discount/query_member_coupon_discount',
		data: discountQuery
	})
}

//确认收货
export function confirmReceiptFunc(orderNo) {
	return requests.post('/mall/mobile/order/confirm_receipt?orderNo=' + orderNo)
}

//支付是否需要密码
export function checkIfNeedPwd(money) {
	return requests.get('/memberApp/memberAccount/checkIfNeedPwd?money=' + money)
}


//删除订单接口
export function deleteOrder(orderNo) {
	return requests.delete('/order_mobile/base/delete_order?orderNo=' + orderNo)
}

//获取积分抵扣
export function getPoints(discountQuery) {
	return requests.post({
		url: '/order_mobile/discount/query_points_discount',
		data: discountQuery
	})
}

//获取配送费用
export function freightFee(freightFeeForm) {
	return requests.post({
		url: '/mall/mobile/order/freight_fee',
		data: freightFeeForm
	})
}

//更新下单信息
export function updatePreOrder(data) {
	return requests.post({
		url: '/mall/mobile/order/update_pre_order',
		data: data
	})
}

//获取订单列表
export function getOrderList(query) {
	return requests.post({
		url: '/mall/mobile/order/order_list',
		data: query
	})
}

//轮询提货单状态
export function pollOrder(query){
	return requests.get({
		url:'/mall/mobile/order/getWriteOffStatus',
		data:query
	})
}

//校验订单状态
export function checkProtectTime(query){
	return requests.get({
		url:'/mall/mobile/order/checkProtectTime',
		data:query
	})
}
// 获取门店状态详情
export function getShopStatus(query) {
	return requests.get({
	  url: `/mall/anon/store/getShopStatus`,
	  data:query
	})
  }
